﻿using LD.Common;
using LdCommunication;
using System;

namespace LD.PLC
{
    public abstract class PLCAbstract
    {
        public abstract void Start(dynamic param);
        public abstract void Stop();
        public abstract ConnStatus ConnStatus { get; set; }

        public abstract event Action<ConnStatus> ConnStatusEvent;


        public abstract OperateResult<byte[]> Read(string address, ushort val);
        public abstract OperateResult<bool[]> ReadBool(string address, ushort val);
        public abstract OperateResult<bool> ReadBool(string address);
        public abstract OperateResult<string> ReadString(string address, ushort val);
        public abstract OperateResult<int> ReadInt(string address);
        public abstract OperateResult<int[]> ReadInt(string address, ushort val);
        public abstract OperateResult<short> ReadInt16(string address);
        public abstract OperateResult<short[]> ReadInt16(string address, ushort val);
        public abstract OperateResult<float> ReadFloat(string address);
        public abstract OperateResult<float[]> ReadFloat(string address, ushort val);
        
        public abstract OperateResult Write(string address, ushort val);
        public abstract OperateResult Write(string address, int val);
        public abstract OperateResult Write(string address, bool val);
        public abstract OperateResult Write(string address, string val);
        public abstract OperateResult Write(string address, byte[] val);
    }
}
